﻿using System;
using System.Collections.Generic;
using System.Linq;
using Oscilloscope.Exception;
using Oscilloscope.Util;

namespace Oscilloscope.Adjust
{
	// Token: 0x0200000C RID: 12
	public abstract class AdjustGrade
	{
		// Token: 0x17000001 RID: 1
		// (get) Token: 0x0600004B RID: 75 RVA: 0x00004FB6 File Offset: 0x000031B6
		public IList<double> AllGrade
		{
			get
			{
				return this.allGrade.AsReadOnly();
			}
		}

		// Token: 0x17000002 RID: 2
		// (get) Token: 0x0600004C RID: 76 RVA: 0x00004FC3 File Offset: 0x000031C3
		public int GradeCount
		{
			get
			{
				return this.allGrade.Count;
			}
		}

		// Token: 0x0600004D RID: 77 RVA: 0x00004FD0 File Offset: 0x000031D0
		public double GetValueOfGrade(int grade)
		{
			if (grade < 0 || grade >= this.allGrade.Count)
			{
				throw new NotSupportGradeException();
			}

            return this.allGrade[grade];
		}
        public static object[] allGradestring =  new object[] {
           "1s"
,"500ms"
,"250ms"
,"100ms"
,"50ms"
,"25ms"
,"10ms"
,"5ms"
,"2.5ms"
,"1ms"
,"500us"
,"250us"
,"100us"
,"50us"};

        public static Dictionary<double, object> Dic = new Dictionary<double, object>();
		// Token: 0x0600004E RID: 78 RVA: 0x00004FF8 File Offset: 0x000031F8
		public int GetGradeOfValue(double value)
		{
			for (int i = 0; i < this.allGrade.Count; i++)
			{
				if (value == this.allGrade[i])
				{
					return i;
				}
			}
			throw new NotSupportGradeException();
		}

		// Token: 0x0600004F RID: 79 RVA: 0x00005031 File Offset: 0x00003231
		public double GetStepOfGrade(int grade)
		{
			if (grade < 0 || grade >= this.allGrade.Count)
			{
				throw new NotSupportGradeException();
			}
			return this.allGrade[grade] / 25.0;
		}

		// Token: 0x06000050 RID: 80 RVA: 0x00005061 File Offset: 0x00003261
		public string GetDisplayStrOfGrade(int grade)
		{
			if (grade < 0 || grade >= this.allGrade.Count)
			{
				throw new NotSupportGradeException();
			}
			return InternalUtils.GetDisplayStrOfValue(this.GetValueOfGrade(grade));
		}

		// Token: 0x04000026 RID: 38
		protected List<double> allGrade;
	}
}
